package com.zero.jewelry.service.Impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zero.common.core.utils.DateUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.zero.jewelry.mapper.ProductTagRelMapper;
import com.zero.jewelry.domain.ProductTagRel;
import com.zero.jewelry.service.IProductTagRelService;

/**
 * 产品标签关联Service业务层处理
 *
 * @author cai-xu-kun
 * @date 2025-07-31
 */
@Service
@RequiredArgsConstructor
public class ProductTagRelServiceImpl extends ServiceImpl<ProductTagRelMapper, ProductTagRel> implements IProductTagRelService {

    private final ProductTagRelMapper productTagRelMapper;

    /**
     * 查询产品标签关联分页
     *
     * @param productTagRel 产品标签关联
     * @param p 分页数据
     * @return 产品标签关联
     */
    @Override
    public Page<ProductTagRel> selectProductTagRelListPage(ProductTagRel productTagRel, Page<ProductTagRel> p) {
        return productTagRelMapper.selectProductTagRelListPage(productTagRel, p);
    }

    /**
     * 查询产品标签关联
     *
     * @param productId 产品标签关联主键
     * @return 产品标签关联
     */
    @Override
    public ProductTagRel selectProductTagRelByProductId(Long productId) {
        return productTagRelMapper.selectProductTagRelByProductId(productId);
    }

    /**
     * 查询产品标签关联列表
     *
     * @param productTagRel 产品标签关联
     * @return 产品标签关联
     */
    @Override
    public List<ProductTagRel> selectProductTagRelList(ProductTagRel productTagRel) {
        return productTagRelMapper.selectProductTagRelList(productTagRel);
    }

    /**
     * 新增产品标签关联
     *
     * @param productTagRel 产品标签关联
     * @return 结果
     */
    @Override
    public int insertProductTagRel(ProductTagRel productTagRel) {
        productTagRel.setCreateTime(DateUtils.getNowDate());
        return productTagRelMapper.insertProductTagRel(productTagRel);
    }

    /**
     * 修改产品标签关联
     *
     * @param productTagRel 产品标签关联
     * @return 结果
     */
    @Override
    public int updateProductTagRel(ProductTagRel productTagRel) {
        return productTagRelMapper.updateProductTagRel(productTagRel);
    }

    /**
     * 批量删除产品标签关联
     *
     * @param productIds 需要删除的产品标签关联主键
     * @return 结果
     */
    @Override
    public int deleteProductTagRelByProductIds(Long[] productIds) {
        return productTagRelMapper.deleteProductTagRelByProductIds(productIds);
    }

    /**
     * 删除产品标签关联信息
     *
     * @param productId 产品标签关联主键
     * @return 结果
     */
    @Override
    public int deleteProductTagRelByProductId(Long productId) {
        return productTagRelMapper.deleteProductTagRelByProductId(productId);
    }
}
